package lapsnake.model.stmt;

import java.awt.Component;
import lapsnake.model.data.*;

import lapsnake.model.*;
import lapsnake.py.ast.ASTHelperFactory; 
import lapsnake.ui.JTreeLabel;

import java.beans.PropertyVetoException;

import org.python.antlr.ast.*;

/**Wrapper class with helper functions for Assign nodes*/
public class LapAssign extends LapStatement {
	public final ChildList<LapExpression> targets = new ChildList<>(this, LapExpression.class, false);
	public final SingleChild<LapExpression> value = new SingleChild<>(this, LapExpression.class);
	
	public LapAssign(PyAST pyAST, ChildField<? super LapAssign> parent, Assign node) throws PropertyVetoException {
		super(pyAST, parent, node);
		
		ASTHelperFactory.makeHelpers(pyAST, targets, node.getInternalTargets());
		ASTHelperFactory.makeHelper(pyAST, value, node.getInternalValue());
		
		buildTextNodes(node);
	}
	@Override
	protected Component getFillerComponent(int childIndex,
		ChildField<?> childField)
	{
		if(childField == targets)
			return new JTreeLabel("Set", false);
		else
			return new JTreeLabel("to", false);
	}
}
